function collect_results(filename, y, pred, num_labels, m)

fid = fopen (filename, "w");
matrix = zeros(num_labels, num_labels);
for i = 1:m
matrix(y(i), pred(i)) = matrix(y(i), pred(i)) + 1;
endfor
%matrix

fprintf(fid,'Karcinom pluća\n');
table = confusion_table(matrix, 1);
precision_calculator(fid, table);

fprintf(fid,'Karcinom bubrega\n');
table = confusion_table(matrix, 2);
precision_calculator(fid, table);

fprintf(fid,'Karcinom dojke\n');
table = confusion_table(matrix, 3);
precision_calculator(fid, table);
fclose (fid);

end